package com.wjs.lock;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;

public class ThreadDemo3 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        List<String> list1 = Collections.synchronizedList(list);
        Vector<Object> vector = new Vector<>();
        for (int i = 1; i <= 10; i++) {
            new Thread(()->{
                list1.add(UUID.randomUUID().toString().substring(0,8));
                System.out.println(list1);
            },String.valueOf(i)).start();
        }
    }
}
